import 'package:flutter/material.dart';
import 'package:beijingbus/pages/city/city.dart';
import 'dart:math';

class HomePage extends StatefulWidget {
  @override
  _HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  int tabIndex = 0;

  @override
  Widget build(BuildContext context) {
    print(Random().nextInt(20));
    Future<String> loadString =
        DefaultAssetBundle.of(context).loadString("assets/data.json");
    loadString.then((String value) => {print(value)});
    return Scaffold(
      appBar: AppBar(
        title: Text('去哪玩'),
      ),
      body: Container(
        width: MediaQuery.of(context).size.width,
        height: MediaQuery.of(context).size.height,
        color: Colors.black,
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Text(
              '今年去哪里过年?',
              style: TextStyle(
                color: Colors.white,
                fontSize: 32.0,
                fontWeight: FontWeight.bold,
              ),
            ),
            SizedBox(height: 20.0),
            Text(
              '不确定？我帮你',
              style: TextStyle(
                color: Colors.white,
                fontSize: 26.0,
              ),
            ),
            SizedBox(height: 100.0),
            FlatButton(
              onPressed: () {
                print('点击');
                Navigator.of(context).push(
                  MaterialPageRoute(
                    builder: (context) {
                      return CityPage();
                    },
                  ),
                );
              },
              child: Container(
                width: 160.0,
                height: 50.0,
                decoration: BoxDecoration(
                  color: Colors.green,
                  borderRadius: BorderRadius.all(Radius.circular(10.0)),
                ),
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: [
                    Text(
                      '选一下',
                      style: TextStyle(fontSize: 20.0, color: Colors.white),
                    ),
                  ],
                ),
              ),
            )
          ],
        ),
      ),
    );
  }
}
